package org.pinggcal;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 
 * @author Mirco
 */
public class PingUtil {

	protected static boolean testServer(String server) {
		boolean res = false;
		try {
			InetAddress address = InetAddress.getByName(server);
			System.out.println("Name: " + address.getHostName());
			System.out.println("Addr: " + address.getHostAddress());
			System.out.println("Reach: " + address.isReachable(3000));

			res = address.isReachable(3000);

		} catch (UnknownHostException e) {
			System.err.println(String.format("Unable to {0}", server));
		} catch (IOException e) {
			System.err.println(String.format("Unable to reach {0}", server));
		}
		return res;
	}
}
